package com.demo.fieldbind.model;

import cn.hutool.core.util.RandomUtil;
import com.demo.fieldbind.BindTypeEnum;
import com.demo.fieldbind.CustomFieldBind;
import lombok.Getter;
import lombok.Setter;

import java.util.List;
import java.util.Set;

/**
 * @author shenguangyang
 */
@Getter
@Setter
public class FieldBindTestReq {
    @CustomFieldBind(type = BindTypeEnum.USER_STATUS, target = "statusText")
    private Integer status;

    private String statusText;

    @CustomFieldBind(type = BindTypeEnum.DATA3_STATUS, target = "data3StatusText")
    private Integer data3Status;
    private String data3StatusText;

    @CustomFieldBind(type = BindTypeEnum.DATA1_STATUS, target = "data1StatusText")
    private Integer data1Status;
    private String data1StatusText;

    private FieldBindTestReq01 req01;
    private FieldBindTestReq req;

    private FieldBindTestReq01[] req01s;

    private List<FieldBindTestReq01> req01List;

    private Set<FieldBindTestReq01> req01Set;

    public FieldBindTestReq() {
    }

    public static FieldBindTestReq initTest() {
        FieldBindTestReq fieldBindTestReq = new FieldBindTestReq();
        int i = RandomUtil.randomInt(1, 10);
        fieldBindTestReq.status = i > 6 ? null : i;
        fieldBindTestReq.data1Status = i > 2 ? null : i;
        fieldBindTestReq.data3Status = i > 3 ? null : i;
        return fieldBindTestReq;
    }
}
